/*
 * Notify.h
 *
 *  Created on: 2011-5-29
 *      Author: yangentao@gmail.com
 */

#ifndef NOTIFY_H_
#define NOTIFY_H_
#include "../pre.h"


class Notifable: public trackable {
public:
	virtual ~Notifable();
};

//大小写不敏感,
namespace Notify {
	typedef function<void (Notifable* instance, int, any)> NotifyCallback;

	void Fire(Notifable* instance, int msg, any data = any());
	//group =0 是, pos表示在所有回调的前或后
	connection Add(Notifable* instance, int msg, NotifyCallback callback, int group = 0, connect_position pos = at_back);
	void Remove(connection con);
	void Remove(Notifable* instance, int msg);
	void Remove(Notifable* instance);
};

#endif /* NOTIFY_H_ */
